﻿
using B.S.Warehouse.Domain.goods;
using B.S.Warehouse.ErrorCord;
using B.S.Warehouse.Read.Api.Application.Command.GoodsCommand;
using MediatR;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Warehouse.Read.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class GoodsController : ControllerBase
    {
        private readonly IMediator mediator;

        public GoodsController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 货品信息显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResult<ApiPaging<GoodsModel>>> GetGoods([FromQuery] GetGoodsCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 货品信息反填
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResult<List<GoodsModel>>> FTGoods([FromQuery] FTGoodsCommand request)
        {
            return await mediator.Send(request);
        }

    }
}
